package com.yun.zhong.fu.usercenter.controller;

import com.yun.zhong.fu.usercenter.dao.UserDao;
import com.yun.zhong.fu.usercenter.entity.User;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @Author RenPu
 * @Date 2020/12/28 13:12
 * @Version 1.0
 * @Description:
 **/

@RestController

//解决userDao 自动装配爆红的问题
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class TestUserController {

    private final UserDao userDao;

    @GetMapping("/test")
    public String testInsert() {
        try {
            User user = new User();
            user.setAvatarUrl("wwww.baidu.com");
            user.setCreateTime(new Date());
            user.setWxNickname("马武");
            user.setWxId("1279544372@qq.com");
            user.setRoles("admin");
            user.setAvatarUrl("www.bibili.com");
            user.setBonus(20);
            userDao.insert(user);
            return "插入数据成功！！！！";
        } catch (Exception e) {
            e.getMessage();
        }
        return "插入数据失败o(╥﹏╥)o";
    }



}
